package com.apes.auto.car.repository;

import com.apes.auto.car.model.VehicleLabel;
import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Map;

public interface VehicleLabelRepository extends CustomRepository<VehicleLabel, String> {
    @Query("select new map(T.id as id) from VehicleLabel T")
    List<Map<String, String>> findByAll();

    List<VehicleLabel> findAllByCarBrand_idOrManufacturers_Id(String cId, String mID);

    @Query(value = " select A from VehicleLabel A left join CarTypeConfiguration b on a.id = b.PZCXID where b.PZCXID = :jekunCode and rownum = 1 ", nativeQuery = true)
    VehicleLabel findOneByJekunCode(@Param("jekunCode")String jekunCode);
}
